package com.tc.picturesynthesis.second.controller;


import cn.hutool.core.img.Img;
import cn.hutool.core.img.ImgUtil;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;


public class TestController {
    /**
     * 测试方法   使用huttol进行简单的图片合成,合成的位置在图片中间
     *
     * @param args args
     * @throws IOException IOException
     */
    public static void main(String[] args) throws IOException {
        // 读取二维码图片和底图
        BufferedImage qrCodeImage = ImageIO.read(new File("D:/pic/qrBD/BD/111.jpg"));
        BufferedImage backgroundImage = ImageIO.read(new File("C:/Users/Jerry/Desktop/图片视频文件/1701759849150.jpg"));

        // 合成图片
        BufferedImage combinedImage = (BufferedImage) ImgUtil.pressImage(backgroundImage, qrCodeImage, 0, 0, 1.0f);

        // 输出合成后的图片
        ImageIO.write(combinedImage, "png", new File("D:/pic/qrBD/BD/112.jpg"));

    }
}
